package structual_pattern.proxy_pattern;

public class ProxyPattern {

}
class Logger{
    public void Log(){
        System.out.println("logging");
    }
}
interface Searcher{
    String doSearch();
}
class RealSearcher implements Searcher{
    @Override
    public String doSearch() {
        System.out.println("search");
        return "search";
    }
}
class ProxySearcher implements Searcher{
    private RealSearcher searcher = new RealSearcher();
    private Logger logger = new Logger();

    @Override
    public String doSearch() {
        Log();
        return searcher.doSearch();
    }

    public void Log() {
        logger.Log();
    }

}
